import random
send = [['a', 'a'], ['b', 'b'], ['c', 'c'], ['d', 'd'], ['e', 'e']]
rev = []
n = len(send)
print(n)
gifts = []
for i in send:
    gifts += i[1]
for i in range(n):
    flag = 0
    people = send[i][0]
    gift = send[i][1]
    if gift in gifts:
        gifts.remove(gift)
        flag = 1
    revgift = random.choice(gifts)
    rev.append([people, revgift])
    gifts.remove(revgift)
    if flag:
        gifts.append(gift)
print(rev)